package com.wondertek.poms.dao.po;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.wondertek.poms.common.constant.CurrentUser;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;

import lombok.Data;

@Data
@Entity
@Table(name = "SELLING_PRICE_TAG")
@DynamicUpdate
@DynamicInsert
@Proxy(lazy = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SellingPriceTag {
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SELLING_PRICE_TAG_SEQ")
	@SequenceGenerator(name = "SELLING_PRICE_TAG_SEQ", allocationSize = 1, sequenceName = "SELLING_PRICE_TAG_SEQ")
	private Long id;// 主键
	
	@Column(name = "PRD_INFO_ID")
	private String prdInfoId;// 商品包id
	
	@Column(name = "PRD_INFO_NAME")
	private String prdInfoName;// 商品包名称
	
	@Column(name = "PRICE")
	private String price;// 售价
	
	@Column(name = "MAM_RECOMMEND")
	private String mamRecomend;// 标签
	
	@Column(name = "PRODUCT_ID")
	private Long productId;// 产品编号id
	
	@Column(name = "CREATOR")
	private String creator;// 创建人
	
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "CREATE_TIME")
	private Date createTime;// 创建时间

	public static void putTimeAndUser(SellingPriceTag sellingPriceTag) {
		sellingPriceTag.setCreator(CurrentUser.currUserName());
		sellingPriceTag.setCreateTime(new Date());
	}

}
